home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 497 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.3 KB

  1. From: johnw@jove.acs.unt.edu (John R. Williams)
  2. Message-ID: <4fukhs$fc3@hermes.acs.unt.edu>
  3. X-Original-Date: 15 Feb 1996 06:41:00 GMT
  4. Path: in2.uu.net!bounce-back
  5. Date: 15 Feb 96 12:07:00 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Newsgroups: comp.std.c++
  8. Subject: Re: #ifdef XXXX
  9. Organization: University of North Texas
  10. References: <1996Feb1.092058.4745@iiasa.ac.at> <9602020740.22411@mulga.cs.mu.OZ.AU> <9602141406.AA16760@sparc5.ferndown.ate.slb.com>
  11. X-Newsreader: TIN [version 1.2 PL2]
  12. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  13.     iQBFAgUBMSMiseEDnX0m9pzZAQFAoQF9F2FNpYF7NxT960qJNX1bKNa5ZlHcQWSh
  14.     Yc8F2Q8v0F0SnWEDjlzqC7u+5J40ePdS
  15.     =HrhA
  16.  
  17. devitto@ferndown.ate.slb.com wrote:
  18. > What about Bjarne's idea of "include" as a keyword that only has the effect
  19. > of a #include if the file has not been "include"d already.
  20.  
  21. > I suppose the idea is that the compiler builds a table (like gcc does for
  22. > wrapped includes) - pretty simple really.
  23.  
  24. > Ideas about why this won't work ???
  25.  
  26. Personally I'll continue to advocate "#once" to prevent multiple 
  27. inclusion of a header for these reasons:
  28.  
  29.   Although it adds no new capability to the language, it would be trivial 
  30.   to implement and to specify in a standard. The benefit it that it
  31.   prevents programmers from having to do a little of the kind of mindless
  32.   robotic work that computers do so much better than humans.
  33.  
  34.   I don't like Bjarne's idea because I would think that the writer of
  35.   any given header knows more about how many times it should be included
  36.   than the user. If it *does* need to be multi-included, it is reasonable
  37.   to expect to the programmer would forget to use the traditional include
  38.   mechanism alarmingly often. C++ already has enough things like this that
  39.   silently cause strange errors when the programmer forgets something
  40.   (like everyone's favorite, the switch statement). Conversely, many would 
  41.   countinue to use the old mechanism, which would not work too well, while 
  42.   #once is 100% backwards compatible.
  43.  
  44. --
  45. #define REAL_NAME "John Williams"
  46. #define E_MAIL    "johnw@jove.acs.unt.edu"
  47. #define HOMEPAGE  "http://www.unt.edu/~johnw"
  48. ---
  49. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  50.   Contact address: std-c++-request@ncar.ucar.edu.  Moderation policy:
  51.   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html. ]
  52.